/*   1:    */ package org.intellij.plugins.relaxNG.model.descriptors;
/*   2:    */ 
/*   3:    */

import com.intellij.openapi.util.Condition;
import com.intellij.psi.xml.XmlTag;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.xml.XmlAttributeDescriptor;
import com.intellij.xml.XmlElementDescriptor;
import org.jetbrains.annotations.Nullable;
import org.kohsuke.rngom.digested.DElementPattern;
import org.kohsuke.rngom.digested.DPattern;

import javax.xml.namespace.QName;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/*   4:    */
/*   5:    */
/*   6:    */
/*   7:    */
/*   8:    */
/*   9:    */
/*  10:    */
/*  11:    */
/*  12:    */
/*  13:    */
/*  14:    */
/*  15:    */
/*  16:    */ 
/*  17:    */ public class CompositeDescriptor
/*  18:    */   extends RngElementDescriptor
/*  19:    */ {
/*  20:    */   private final DElementPattern[] e;
/*  21:    */   
/*  22:    */   CompositeDescriptor(RngNsDescriptor paramRngNsDescriptor, DElementPattern paramDElementPattern, List<DElementPattern> paramList)
/*  23:    */   {
/*  24: 37 */     super(paramRngNsDescriptor, paramDElementPattern);
/*  25: 38 */     this.e = ((DElementPattern[])paramList.toArray(new DElementPattern[paramList.size()]));
/*  26:    */   }
/*  27:    */   
/*  28:    */   protected XmlElementDescriptor findElementDescriptor(XmlTag paramXmlTag)
/*  29:    */   {
/*  30: 42 */     ArrayList localArrayList = new ArrayList();
/*  31: 43 */     for (DPattern localDPattern : this.e) {
/*  32: 44 */       localArrayList.addAll(ChildElementFinder.find(2, localDPattern));
/*  33:    */     }
/*  34: 54 */     ??? = this.myNsDescriptor.findDescriptor(paramXmlTag, localArrayList);
/*  35: 55 */     if (??? != null) {
/*  36: 56 */       return ???;
/*  37:    */     }
/*  38: 58 */     return NULL;
/*  39:    */   }
/*  40:    */   
/*  41:    */   public XmlElementDescriptor[] getElementsDescriptors(XmlTag paramXmlTag)
/*  42:    */   {
/*  43: 62 */     ArrayList localArrayList = new ArrayList(Arrays.asList(super.getElementsDescriptors(paramXmlTag)));
/*  44: 63 */     for (DElementPattern localDElementPattern : this.e)
/*  45:    */     {
/*  46: 64 */       List localList = ChildElementFinder.find(2, localDElementPattern);
/*  47: 65 */       localArrayList.addAll(Arrays.asList(this.myNsDescriptor.convertElementDescriptors(localList)));
/*  48:    */     }
/*  49: 67 */     return (XmlElementDescriptor[])localArrayList.toArray(new XmlElementDescriptor[localArrayList.size()]);
/*  50:    */   }
/*  51:    */   
/*  52:    */   protected XmlAttributeDescriptor getAttributeDescriptor(String paramString1, String paramString2)
/*  53:    */   {
/*  54: 71 */     QName localQName = new QName(paramString1, paramString2);
/*  55:    */     
/*  56: 73 */     return computeAttributeDescriptor(AttributeFinder.find(localQName, this.e));
/*  57:    */   }
/*  58:    */   
/*  59:    */   protected XmlAttributeDescriptor[] collectAttributeDescriptors(@Nullable XmlTag paramXmlTag)
/*  60:    */   {
/*  61: 77 */     final QName localQName = null;
/*  62:    */     Object localObject;
/*  63: 79 */     if (localQName == null)
/*  64:    */     {
/*  65: 80 */       localObject = this.e;
/*  66:    */     }
/*  67:    */     else
/*  68:    */     {
/*  69: 82 */       List localList = ContainerUtil.findAll(this.e, new Condition()
/*  70:    */       {
/*  71:    */         public boolean value(DElementPattern paramAnonymousDElementPattern)
/*  72:    */         {
/*  73: 84 */           return paramAnonymousDElementPattern.getName().contains(localQName);
/*  74:    */         }
/*  75: 86 */       });
/*  76: 87 */       localObject = (DPattern[])localList.toArray(new DPattern[localList.size()]);
/*  77:    */     }
/*  78: 90 */     return computeAttributeDescriptors(AttributeFinder.find((DPattern[])localObject));
/*  79:    */   }
/*  80:    */   
/*  81:    */   public boolean equals(Object paramObject)
/*  82:    */   {
/*  83: 94 */     if (this == paramObject) {
/*  84: 94 */       return true;
/*  85:    */     }
/*  86: 95 */     if ((paramObject == null) || (getClass() != paramObject.getClass())) {
/*  87: 95 */       return false;
/*  88:    */     }
/*  89: 96 */     if (!super.equals(paramObject)) {
/*  90: 96 */       return false;
/*  91:    */     }
/*  92: 98 */     CompositeDescriptor localCompositeDescriptor = (CompositeDescriptor)paramObject;
/*  93:100 */     if (!Arrays.equals(this.e, localCompositeDescriptor.e)) {
/*  94:100 */       return false;
/*  95:    */     }
/*  96:102 */     return true;
/*  97:    */   }
/*  98:    */   
/*  99:    */   public int hashCode()
/* 100:    */   {
/* 101:106 */     int i = super.hashCode();
/* 102:107 */     i = 31 * i + Arrays.hashCode(this.e);
/* 103:108 */     return i;
/* 104:    */   }
/* 105:    */   
/* 106:    */   public DElementPattern[] getElementPatterns()
/* 107:    */   {
/* 108:112 */     return this.e;
/* 109:    */   }
/* 110:    */ }



/* Location:           E:\idea\

 * Qualified Name:     org.intellij.plugins.relaxNG.model.descriptors.CompositeDescriptor

 * JD-Core Version:    0.7.0.1

 */